<template>
	<view class="content">
		<view class="section-title">服务评价</view>
		<view class="rating-options">
			<view class="rating-option" v-for="(option, index) in ratingOptions" :key="index"
				:class="{ active: selectedRating === index }" @click="selectRating(index)">
				<view class="chageYuan" :class="{ activeYuan: selectedRating === index }"></view>
				{{ option }}
			</view>
		</view>
		<view class="section-title">评价内容</view>
		<view class="inputBox">
			<input type="text" v-model="evaluateValue" />
		</view>
		<view class="submitBox">
			<view class="submitBtn" @click="submitNext()">提交</view>
		</view>
	</view>
</template>

<script setup>
	import {
		ref,
		computed
	} from "vue"
	import {
		onLoad
	} from '@dcloudio/uni-app';
	const getStatusType = ref(null)
	const selectedRating = ref(null);
	const evaluateValue = ref('')
	const ratingOptions = ref(['非常满意', '满意', '一般', '不满意']);
	// 接收页面参数
	onLoad((options) => {
		if (options.statusType) {
			getStatusType.value = parseInt(options.statusType);
		}
	})
	// 选择评分
	const selectRating = (index) => {
		selectedRating.value = index;
	};
	// 提交
	const submitNext = () => {
		console.log('点击提交')
	}
</script>

<style lang="scss" scoped>
	.section-title {
		width: 90%;
		margin: 0 auto;
		font-weight: bold;
		height: 80rpx;
		line-height: 80rpx;
	}

	.rating-options {
		width: 90%;
		margin: 0 auto;
		display: flex;
		align-items: center;
		margin-bottom: 20rpx;
		.rating-option {
			display: flex;
			align-items: center;
			margin-right: 50rpx;

			.chageYuan {
				width: 24rpx;
				height: 24rpx;
				border: 1rpx solid #666;
				box-sizing: border-box;
				border-radius: 50%;
				margin-right: 6rpx;
			}

			.activeYuan {
				border: none;
				background-color: #55aaff;
			}
		}

		.active {
			color: #55aaff;
		}
	}
	.inputBox{
		width: 90%;
		height: 80rpx;
		background-color: #F2F2F2;
		margin: 0 auto;
		border-radius: 10rpx;
		input{
			width: 92%;
			margin-left: 4%;
			height: 80rpx;
		}
	}
	.submitBox{
		width: 100%;
		height: 150rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		position: fixed;
		bottom: 0;
		left: 0;
		.submitBtn{
			width: 90%;
			height: 80rpx;
			background-color: #55aaff;
			display: flex;
			align-items: center;
			justify-content: center;
			color: #fff;
			border-radius: 10rpx;
		}
	}
</style>